Skip to content

Conversation

@resistor
Copy link
Collaborator

@resistor resistor commented Jun 5, 2025

It was always intended to be treated as such, but when upstream added support for EABI, we
missed updating the check in the frontend to handle CHERIoT as well.

This manifests as a bug only in one very specific scenario: clang maintains compatibility
with non-conforming versions of GCC that do not properly align doubles on the stack when
targeting EABI, aligning them instead to 4 bytes. CHERIoT does not specifically care whether
or not we are using the GCC-compatible version, but if the frontend and backend disagree
on which version we are using, then the caller and callee will end up with incompatible stack
layouts. This is because the caller layout is constructed by the backend, while the callee
layout is constructed by the frontend.

@davidchisnall
Copy link

At some point, we will want to use capability registers to hold doubles (if we support a variant of Zdinx and possibly for softfloat as well), so we do require 8-byte alignment.

@resistor
Copy link
Collaborator Author

resistor commented Jun 5, 2025

At some point, we will want to use capability registers to hold doubles (if we support a variant of Zdinx and possibly for softfloat as well), so we do require 8-byte alignment.

Changed it so both frontend and backend disable the GCC workaround for Cheriot ABIs.

rmn30 added a commit to CHERIoT-Platform/cheriot-rtos that referenced this pull request Jun 6, 2025
See CHERIoT-Platform/llvm-project#165 .  This
fails with current dev container but should pass once the above PR is
merged and a new dev container built.
rmn30 added a commit to CHERIoT-Platform/cheriot-rtos that referenced this pull request Jun 6, 2025
See CHERIoT-Platform/llvm-project#165 .  This
fails with current dev container but should pass once the above PR is
merged and a new dev container built.
@resistor resistor force-pushed the f64-varargs branch 2 times, most recently from 0eaa523 to 0185c6c Compare June 6, 2025 14:32
…HERIoT counts as EABI.

It was always intended to be treated as such, but when upstream added support for EABI, we
missed updating the check in the frontend to handle CHERIoT as well.

This manifests as a bug only in one very specific scenario: clang maintains compatibility
with non-conforming versions of GCC that do not properly align doubles on the stack when
targeting EABI, aligning them instead to 4 bytes. CHERIoT does not specifically care whether
or not we are using the GCC-compatible version, but if the frontend and backend disagree
on which version we are using, then the caller and callee will end up with incompatible stack
layouts. This is because the caller layout is constructed by the backend, while the callee
layout is constructed by the frontend.
@resistor resistor merged commit 8896e09 into CHERIoT-Platform:cheriot Jun 7, 2025
7 checks passed
rmn30 added a commit to CHERIoT-Platform/cheriot-rtos that referenced this pull request Jun 11, 2025
See CHERIoT-Platform/llvm-project#165 .  This
fails with current dev container but should pass once the above PR is
merged and a new dev container built.
rmn30 added a commit to CHERIoT-Platform/cheriot-rtos that referenced this pull request Jun 11, 2025
See CHERIoT-Platform/llvm-project#165 .  This
fails with current dev container but should pass once the above PR is
merged and a new dev container built.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants